package user

import (
	"onvif_server/internal/model/field"
	"onvif_server/pkg/db"
)

type CreateReq struct {
	Username string       `json:"username" binding:"required,max=30"`
	Password string       `json:"password" binding:"required,min=6,max=50"`
	Status   field.Status `json:"status" binding:"omitempty"`
}

type ListReq struct {
	Keyword string `json:"keyword" query:"keyword" form:"keyword" binding:"omitempty"`
	db.Paginator
}

type UpdateReq struct {
	ID       int64        `json:"id"  binding:"required,min=1"`
	Username string       `json:"username" binding:"required,max=30"`
	Password string       `json:"password" binding:"omitempty,min=6,max=50"`
	Status   field.Status `json:"status" binding:"omitempty"`
}

type LoginReq struct {
	Username string `json:"username" binding:"required" example:"admin"`
	Password string `json:"password" binding:"required,min=6,max=30" example:"123456"`
	Remember bool   `json:"remember" binding:"omitempty"`
}

type LoginRes struct {
	UserId             int64  `json:"user_id"`
	Token              string `json:"token"`
	TokenExpire        int64  `json:"token_expire"`
	RefreshToken       string `json:"refresh_token"`
	RefreshTokenExpire int64  `json:"refresh_token_expire"`
}

type RefreshTokenReq struct {
	RefreshToken string `json:"refresh_token" binding:"required"`
}

type ProfileRes struct {
	UserID   int64        `json:"user_id"`
	Username string       `json:"username"`
	Role     string       `json:"role"`
	Status   field.Status `json:"status"`
}
